const ageStateType: any = {
  six: {
    id: 1,
    name: '请选择',
    field: '1',
  },
  one: {
    id: 2,
    name: '18-24',
    field: 'A0',
  },
  two: {
    id: 3,
    name: '25-34',
    field: 'A1',
  },
  three: {
    id: 4,
    name: '35-44',
    field: 'A2',
  },
  four: {
    id: 5,
    name: '45-54',
    field: 'A3',
  },
  five: {
    id: 6,
    name: '55以上',
    field: 'A4',
  },
};
ageStateType.fieldFromName = (name: string) => {
  let resultField = undefined;
  for (let key of Object.keys(ageStateType)) {
    if (name === ageStateType[key].name) {
      resultField = ageStateType[key].field;
      break;
    }
  }
  return resultField;
};
ageStateType.allTypeNames = () => {
  let names: any = [];
  Object.keys(ageStateType).forEach((key) => {
    let field = ageStateType[key].field;
    if (field != undefined) {
      if (field != '' && field.length >= 1) {
        names.push(ageStateType[key].name);
      }
    }
  });
  return names;
};
ageStateType.nameFromField = (field: string) => {
  let resultName: string = '';
  for (let key of Object.keys(ageStateType)) {
    if (field === ageStateType[key].field) {
      resultName = ageStateType[key].name;
      break;
    }
  }
  return resultName;
};
export default ageStateType;
